<template>
	<view class="smart-verify-container">

		<view class="verify-methods">
			<view class="method-section">
				<h3 class="method-title">方式一：输入设备编码绑定</h3>
				<p class="method-desc">设备编号在设备背面门11位逐个输入后点击下方"绑定按钮"</p>

				<view class="input-section">
					<view class="device-code-input">
						<span class="input-label"><span class="required">*</span>设备编号</span>
						<input type="text" placeholder="请输入设备编号" />
					</view>
				</view>
			</view>

			<view class="method-section">
				<h3 class="method-title">方式二：扫码绑定</h3>
				<p class="method-desc">点击下方扫码，找到设备背面二维码，手电筒对准码扫一下</p>

				<view class="scan-area">
					<view class="scan-circle" @tap="scanBarCode" style="width: 120px;height: 120px;">
						<img src="https://www.ruilongan.com/profile/upload/2025/06/25/scan_20250625100112A042.png"
							alt="scan" style="width: 120px;height: 120px;" />
					</view>
				</view>
			</view>
		</view>

		<view class="bottom-buttons">
			<button class="bind-btn">
				<span class="btn-text">绑定设备</span>
				<span class="points-text">绑定领取50积分新人礼</span>
			</button>
			<button class="buy-btn">无设备，去购买</button>
		</view>

		<!-- Footer -->
		<view class="footer">
			<view class="footer-text">"您的医疗数据：采用银行级加密存储储存时可联系客服注销"</view>
			<view class="hotline" @click="clickCell('400-698-9967')">
				<img src="https://api.iconify.design/material-symbols:security.svg" class="phone-icon" />
				400-698-9967
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'SmartDevicesVerify',
		data() {
			return {
				deviceCode: ''
			}
		},
		methods: {
			scanBarCode() {
				uni.scanCode({
					success: (res) => {
						console.log(res.result)
					},
					fail: (err) => {
						console.error('扫描失败:', err);
					}
				});
			},
			clickCell(phone) {
				uni.makePhoneCall({
					phoneNumber: phone, //电话号码
					success: function(e) {
						console.log(e);
					},
					fail: function(e) {
						console.log(e);
					}
				})
			},
		}
	}
</script>

<style scoped>
	.smart-verify-container {
		padding: 0 24px;
		min-height: 100vh;
		background-color: #fff;
	}

	.title {
		font-size: 17px;
		font-weight: 500;
	}

	.method-section {
		padding-top: 30px;
	}

	.method-title {
		font-size: 16px;
		font-weight: 500;
		margin-bottom: 8px;
		color: #000;
	}

	.method-desc {
		color: #C3C3C3;
		font-size: 12px;
		margin-bottom: 10px;
	}

	.input-section {
		margin-top: 16px;
	}

	.device-code-input {
		display: flex;
		align-items: center;
		background-color: #FBFBFB;
		padding: 24px;
		border-radius: 8px;
	}

	.input-label {
		color: #333;
		font-size: 14px;
		margin-right: 16px;
		white-space: nowrap;
	}

	.device-code-input input {
		flex: 1;
		height: 20px;
		border: none;
		background: transparent;
		font-size: 14px;
		color: #333;
		padding: 0;
		text-align: right;
	}

	.device-code-input input::placeholder {
		color: #B7B7B7;
		text-align: right;
	}

	.scan-area {
		display: flex;
		justify-content: center;
		align-items: center;
		height: 200px;
	}

	.scan-circle {
		width: 120px;
		height: 120px;
		border-radius: 50%;
		background: rgba(75, 181, 67, 0.1);
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.bottom-buttons {
		position: fixed;
		bottom: 180px;
		left: 16px;
		right: 16px;
	}

	.bind-btn {
		width: 80%;
		height: 44px;
		background-color: #C2F5E0;
		color: #4CD080;
		border: none;
		border-radius: 6px;
		font-size: 18px;
		margin-bottom: 8px;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		padding: 8px 0;
	}

	.btn-text {
		line-height: 1.2;
	}

	.points-text {
		font-size: 10px;
		color: #FF5858;
		line-height: 1;
		letter-spacing: 2rpx;
	}

	.buy-btn {
		width: 80%;
		height: 40px;
		background-color: #4CD080;
		color: white;
		border: none;
		border-radius: 4px;
		font-size: 16px;
	}

	.footer {
		position: fixed;
		bottom: 40px;
		left: 0;
		right: 0;
		text-align: center;
	}

	.footer-text {
		font-size: 14px;
		color: #979797;
		margin-bottom: 18px;
	}

	.hotline {
		display: flex;
		align-items: center;
		justify-content: center;
		color: #1696FF;
		font-size: 14px;
	}

	.phone-icon {
		width: 18px;
		height: 18px;
		margin-right: 5px;
		color: #1696FF;
	}
</style>